Passed
Push — main ( c3163a...9d001c )
by Andrii
03:28
created

react-typing.test.ts ➔ FWithout   A

Complexity

Conditions 1

Size

Total Lines 1
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 1
rs 10
c 0
b 0
f 0
cc 1
1
//@ts-nocheck
2
import type { JSXElementConstructor, Component, ReactElement } from "react"
3
import { ClassNamed, ClassNamesProperty, ClassHash } from "../src/main.types"
4
5
function FWith(_: ClassNamed & ClassNamesProperty<{a: ClassHash}>) { return null }
6
function FWithout(_: ClassNamed) { return null }
7
8
describe("extending", () => {
9
  it("function", () => {
10
    type ReactFunction<P = never> = (props: P) => ReactElement<any, any> | null
11
    type FnWithClassNames = ReactFunction<{
12
      classname: any
13
      [k: string]: any
14
    }>
15
    // function check1(_: FnWithClassNames) {}
16
    // function check2<T extends FnWithClassNames>(_: T) {}
17
    function check1(_: ReactFunction) {}
18
    function check2<T extends ReactFunction>(_: T) {}
19
    check1(FWith)
20
    check2(FWith)
21
  })
22
  // type X = JSXElementConstructor
23
//     type JSXElementConstructor<P> =
24
// | ((props: P) => ReactElement<any, any> | null)
25
// | (new (props: P) => Component<P, any>);
26
27
28
})